Tests: SkyCoord subclass property AttributeError message (swev-id: astropy__astropy-14096)#17
Closed
rowan-stein wants to merge 3 commits intoastropy__astropy-14096from
Closed
Conversation
added 3 commits
October 19, 2025 20:08
…criptors\n\nWhen a SkyCoord subclass defines a property whose getter raises AttributeError (e.g., accessing a missing attribute on self), Python falls back to __getattr__, which then raises an AttributeError for the original attribute name, masking the root cause.\n\nAdd an early guard in __getattr__ to detect class-level attributes (incl. properties) via the MRO and access them via object.__getattribute__ so that any AttributeError from the descriptor propagates unchanged.\n\nFixes #14.
…serves inner missing attribute message
Collaborator
Author
|
Superseded by PR #16, which now includes the unit test. Closing to keep one-issue-one-PR policy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add unit test ensuring that when a SkyCoord subclass defines a property that accesses a missing attribute, the resulting AttributeError message mentions the missing inner attribute (e.g., 'random_attr') rather than the property name.\n\nThis complements the fix in PR #16.\n\nNotes:\n- Does not alter runtime behavior beyond asserting the intended error message.\n- CI not triggered manually.